import request from '@/utils/request'

// 查询委外加工发料列表
export function listOutSourcing(query) {
  return request({
    url: '/output/outSourcing/list',
    method: 'get',
    params: query
  })
}

// 查询委外加工发料详细
export function getOutSourcing(wfmId) {
  return request({
    url: '/output/outSourcing/' + wfmId,
    method: 'get'
  })
}

// 新增委外加工发料
export function addOutSourcing(data) {
  return request({
    url: '/output/outSourcing',
    method: 'post',
    data: data
  })
}

// 修改委外加工发料
export function updateOutSourcing(data) {
  return request({
    url: '/output/outSourcing',
    method: 'put',
    data: data
  })
}

// 删除委外加工发料
export function delOutSourcing(wfmId) {
  return request({
    url: '/output/outSourcing/' + wfmId,
    method: 'delete'
  })
}
///deleteMx/{wfdId}删除明细
export function delOutMx(wfmId) {
  return request({
    url: '/output/outSourcing/deleteMx/' + wfmId,
    method: 'delete'
  })
}
// 导出委外加工发料
export function exportOutSourcing(query) {
  return request({
    url: '/output/outSourcing/export',
    method: 'get',
    params: query
  })
}
//子查询
export function queryListChild(query) {
  return request({
    url: '/output/outSourcing/getAdd',
    method: 'get',
    params: query
  })
}
//确定
export function courseList(data) {
  return request({
    url: '/output/outSourcing/addMx',
    method: 'post',
    data: data
  })
}
//明细
export function mxList(data) {
  return request({
    url: '/output/outSourcing/getMx/' + data,
    method: 'get',
  })
}
//导出
export function exportOutSourcingMx(order,type) {
  return request({
    url: '/output/outSourcing/getMx/' + order + '/' + type,
    method: 'get',
  })
}
/** 提交 */
export function submitMx(order) {
  return request({
    url: '/output/outSourcing/submitWfm/' + order ,
    method: 'put',
  })
}

/** 撤回 */
export function back(order,desc) {
  return request({
    url: '/output/outSourcing/rollbackOrder/' +order +"/" + desc ,
    method: 'put',
  })
}

/** 审核 */
export function check(order) {
  return request({
    url: '/output/outSourcing/check/' +order ,
    method: 'put',
  })
}

/** 一键检验 */
export function oneClickDelivery(order) {
  return request({
    url: '/output/outSourcing/oneClickDelivery/' +order ,
    method: 'put',
  })
}

/** 出库确认 */
export function confirmCk(id,okNumber) {
  return request({
    url: '/output/outSourcing/confirmCk/' +id+ "/"+okNumber ,
    method: 'put',
  })
}

/** 过账 */
export function wfmPost(order) {
  return request({
    url: '/output/outSourcing/post/' +order ,
    method: 'put',
  })
}
